#include "cttest.h"

#define LABELWIDTH 100
#define LABELHIGHTH 30
#define AVGHEIGHT 30

CtTest::CtTest(QWidget *parent) :
    QWidget(parent)
{
    QFont ft;
    ft.setPixelSize(20);
//*******************************1****************************************//
    QGroupBox *wcTestbox=new QGroupBox(tr(""));
    wcTestbox->setStyleSheet("background-color:#bbb;");
    wcTestbox->setFlat(true);
    QGroupBox *wcTestbbbox =new QGroupBox(tr(""));
    wcTestbbbox->setStyleSheet("background-color:#bbb");
    wcTestbbbox->setFlat(true);
    QGroupBox *wcTestpointbox=new QGroupBox(tr(""));
    wcTestpointbox->setStyleSheet("background-color:#bbb");
    wcTestpointbox->setFlat(true);

    labDate = new QLabel("-");

    wcTest = new QLabel(tr("误差 （自动/手动） 测试"));
    wcTest->setFont(ft);
    wcTestpoint = new QLabel(tr("误差测试点设定"));
    wcTestpoint->setFont(ft);
    Startest = new QPushButton(tr("开始测试"));
    Startest->setFont(ft);

    ft.setPixelSize(15);
    tabWidget=new QTabWidget();
    tabWidget->setFixedSize(900,450);
    QString tabBarStyle = "QTabBar::tab {min-width:100px;background-color:qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 rgb(180,183,188), stop: 1 gray);border: 0px solid;border-top-left-radius: 10px;border-top-right-radius: 10px;padding:5px;}QTabBar::tab:!selected {margin-top: 5px;}QTabBar::tab:selected {background-color:darkblue;color: yellow;}";
    tabWidget->setStyleSheet(tabBarStyle);
    tabWidget->setFont(ft);

    btnStart = new QRadioButton(tr("手动"));
    btnStart->setFont(ft);
    btnStart->setFixedSize(70,30);

    inputBH = new QLabel(tr("输入编号:"));
    inputBH->setFont(ft);
    inputXH = new QLabel(tr("输入型号:"));
    inputXH->setFont(ft);
    edFH = new QLabel(tr("额定负荷:"));
    edFH->setFont(ft);
    xxFH = new QLabel(tr("下限负荷:"));
    xxFH->setFont(ft);
    current1 = new QLabel(tr("一次电流:"));
    current1->setFont(ft);
    current2 = new QLabel(tr("二次电流:"));
    current2->setFont(ft);
    inputJD = new QLabel(tr("输入精度:"));
    inputJD->setFont(ft);
    glYS = new QLabel(tr("功率因素:"));
    glYS->setFont(ft);

    danweiVA1 =new QLabel(tr("VA"));
    danweiVA1->setFont(ft);
    danweiVA2 =new QLabel(tr("VA"));
    danweiVA2->setFont(ft);
    danweiA1 =new QLabel(tr("A"));
    danweiA1->setFont(ft);
    danweiA2 =new QLabel(tr("A"));
    danweiA2->setFont(ft);

    BHEdit= new QLineEdit;
    BHEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    BHEdit->setFont(ft);
    BHEdit->installEventFilter(this);

    XHEdit= new QLineEdit;
    XHEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    XHEdit->setFont(ft);
    XHEdit->installEventFilter(this);

    edEdit= new QLineEdit;
    edEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    edEdit->setFont(ft);
    edEdit->installEventFilter(this);

    xxEdit= new QLineEdit;
    xxEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    xxEdit->setFont(ft);
    xxEdit->installEventFilter(this);

    IEdit1= new QLineEdit;
    IEdit1->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    IEdit1->setFont(ft);
    IEdit1->installEventFilter(this);

    IEdit2= new QLineEdit;
    IEdit2->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    IEdit2->setFont(ft);
    IEdit2->installEventFilter(this);

    JDEdit= new QLineEdit;
    JDEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    JDEdit->setFont(ft);
    JDEdit->installEventFilter(this);

    YSEdit= new QLineEdit;
    YSEdit->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    YSEdit->setFont(ft);
    YSEdit->installEventFilter(this);

    JDcom = new QComboBox;
    JDcom->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    JDcom->setFont(ft);
    JDcom->addItem("0");
    JDcom->addItem("0.2");
    JDcom->addItem("0.5");
    JDcom->addItem("0.2S");
    JDcom->addItem("0.5S");

    user_defined = new QComboBox;
    user_defined->setFixedSize(LABELWIDTH,LABELHIGHTH);
    user_defined->setFont(ft);
    user_defined->addItem("常规点");
    user_defined->addItem("自设定点");

    setting = new QPushButton(tr("设置>>"));
    setting->setFont(ft);
    setting->setFixedSize(LABELWIDTH,LABELHIGHTH);
    setting->hide();
    QHBoxLayout *la = new QHBoxLayout;
    //la->addStretch(1);
    //la->addWidget(wcTest);
    la->addWidget(user_defined);
    la->addWidget(setting);
    la->addStretch(1);
    QHBoxLayout *la1 = new QHBoxLayout;
    //la1->addStretch(1);
    la1->addWidget(inputBH);
    la1->addWidget(BHEdit);
    la1->addStretch(1);
    QHBoxLayout *la2 = new QHBoxLayout;
    //la2->addStretch(1);
    la2->addWidget(inputXH);
    la2->addWidget(XHEdit);
    la2->addStretch(1);
    QHBoxLayout *la3 = new QHBoxLayout;
    //la3->addStretch(1);
    //la3->addSpacing(30);
    la3->addWidget(edFH);
    la3->addWidget(edEdit);
    la3->addWidget(danweiVA1);
    //la3->addWidget(user_defined);
    la3->addStretch(1);
    QHBoxLayout *la4 = new QHBoxLayout;
    //la4->addStretch(1);
    //la4->addSpacing(30);
    la4->addWidget(xxFH);
    la4->addWidget(xxEdit);
    la4->addWidget(danweiVA2);
    //la4->addWidget(setting);
    la4->addStretch(1);
    QHBoxLayout *la5 = new QHBoxLayout;
    //la5->addStretch(1);
    //la5->addSpacing(17);
    la5->addWidget(current1);
    la5->addWidget(IEdit1);
    la5->addWidget(danweiA1);
    la5->addStretch(1);
    QHBoxLayout *la6 = new QHBoxLayout;
   // la6->addStretch(1);
    //la6->addSpacing(17);
    la6->addWidget(current2);
    la6->addWidget(IEdit2);
    la6->addWidget(danweiA2);
    la6->addStretch(1);
    QHBoxLayout *la7 = new QHBoxLayout;
    //la7->addStretch(1);
    la7->addWidget(inputJD);
    la7->addWidget(JDcom);
    la7->addStretch(1);
    QHBoxLayout *la8 = new QHBoxLayout;
    //la8->addStretch(1);
    la8->addWidget(glYS);
    la8->addWidget(YSEdit);
    la8->addStretch(1);
    QHBoxLayout *la9 = new QHBoxLayout;
    //la9->addStretch(1);
    la9->addWidget(btnStart);
    la9->addSpacing(50);
    la9->addWidget(Startest);
    la9->addStretch(1);

    QVBoxLayout *lamian = new QVBoxLayout;
    lamian->addStretch(1);
    lamian->addLayout(la);
    lamian->addLayout(la1);
    lamian->addLayout(la2);
    lamian->addLayout(la3);
    lamian->addLayout(la4);
    lamian->addLayout(la5);
    lamian->addLayout(la6);
    lamian->addLayout(la7);
    lamian->addLayout(la8);
    lamian->addSpacing(10);
    lamian->addLayout(la9);
    lamian->addStretch(1);

//**********************************3********************************************//

    edTest1 = new QLabel(tr("额定测试点1:"));
    edTest1->setFont(ft);
    edTest2 = new QLabel(tr("额定测试点2:"));
    edTest2->setFont(ft);
    edTest3 = new QLabel(tr("额定测试点3:"));
    edTest3->setFont(ft);
    edTest4 = new QLabel(tr("额定测试点4:"));
    edTest4->setFont(ft);
    edTest5 = new QLabel(tr("额定测试点5:"));
    edTest5->setFont(ft);
    edTest6 = new QLabel(tr("额定测试点6:"));
    edTest6->setFont(ft);

    xxTest1 = new QLabel(tr("下限测试点1:"));
    xxTest1->setFont(ft);
    xxTest2 = new QLabel(tr("下限测试点2:"));
    xxTest2->setFont(ft);
    xxTest3 = new QLabel(tr("下限测试点3:"));
    xxTest3->setFont(ft);
    xxTest4 = new QLabel(tr("下限测试点4:"));
    xxTest4->setFont(ft);

    danwei1 = new QLabel(tr("%"));
    danwei1->setFont(ft);
    danwei2 = new QLabel(tr("%"));
    danwei2->setFont(ft);
    danwei3 = new QLabel(tr("%"));
    danwei3->setFont(ft);
    danwei4 = new QLabel(tr("%"));
    danwei4->setFont(ft);
    danwei5 = new QLabel(tr("%"));
    danwei5->setFont(ft);
    danwei6 = new QLabel(tr("%"));
    danwei6->setFont(ft);
    danwei7 = new QLabel(tr("%"));
    danwei7->setFont(ft);
    danwei8 = new QLabel(tr("%"));
    danwei8->setFont(ft);
    danwei9 = new QLabel(tr("%"));
    danwei9->setFont(ft);
    danwei10 = new QLabel(tr("%"));
    danwei10->setFont(ft);

    testEdit1 = new QLineEdit(tr("1"));
    testEdit1->setFont(ft);
    testEdit1->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit1->installEventFilter(this);

    testEdit2 = new QLineEdit(tr("5"));
    testEdit2->setFont(ft);
    testEdit2->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit2->installEventFilter(this);

    testEdit3 = new QLineEdit(tr("20"));
    testEdit3->setFont(ft);
    testEdit3->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit3->installEventFilter(this);

    testEdit4 = new QLineEdit(tr("100"));
    testEdit4->setFont(ft);
    testEdit4->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit4->installEventFilter(this);

    testEdit5 = new QLineEdit(tr("120"));
    testEdit5->setFont(ft);
    testEdit5->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit5->installEventFilter(this);

    testEdit6 = new QLineEdit;
    testEdit6->setFont(ft);
    testEdit6->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit6->installEventFilter(this);

    testEdit7 = new QLineEdit(tr("1"));
    testEdit7->setFont(ft);
    testEdit7->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit7->installEventFilter(this);

    testEdit8 = new QLineEdit(tr("5"));
    testEdit8->setFont(ft);
    testEdit8->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit8->installEventFilter(this);

    testEdit9 = new QLineEdit(tr("20"));
    testEdit9->setFont(ft);
    testEdit9->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit9->installEventFilter(this);

    testEdit10 = new QLineEdit(tr("100"));
    testEdit10->setFont(ft);
    testEdit10->setFixedSize(1.5*LABELWIDTH,LABELHIGHTH);
    testEdit10->installEventFilter(this);

    QPushButton *setting_ok = new QPushButton(tr("确定"));
    setting_ok->setFont(ft);
    setting_ok->setFixedSize(LABELWIDTH,LABELHIGHTH);

    testEdit1->setEnabled(false);
    testEdit2->setEnabled(false);
    testEdit3->setEnabled(false);
    testEdit4->setEnabled(false);
    testEdit5->setEnabled(false);
    testEdit6->setEnabled(false);
    testEdit7->setEnabled(false);
    testEdit8->setEnabled(false);
    testEdit9->setEnabled(false);
    testEdit10->setEnabled(false);

    testRadio1 = new QRadioButton(tr("常规点"));
    testRadio1->setFont(ft);
    testRadio1->setChecked(true);
    testRadio2 = new QRadioButton(tr("自设定点"));
    testRadio2->setFont(ft);

    grop2 = new QButtonGroup;
    grop2->addButton(testRadio1);
    grop2->addButton(testRadio2);
    QHBoxLayout *test = new QHBoxLayout;
    test->addStretch(1);
    test->addWidget(wcTestpoint);
    test->addStretch(1);
    QHBoxLayout *test1=new QHBoxLayout;
    test1->addStretch(1);
    test1->addWidget(edTest1);
    test1->addWidget(testEdit1);
    test1->addWidget(danwei1);
    test1->addStretch(1);

    QHBoxLayout *test2=new QHBoxLayout;
    test2->addStretch(1);
    test2->addWidget(edTest2);
    test2->addWidget(testEdit2);
    test2->addWidget(danwei2);
    test2->addStretch(1);
    QHBoxLayout *test3=new QHBoxLayout;
    test3->addStretch(1);
    test3->addWidget(edTest3);
    test3->addWidget(testEdit3);
    test3->addWidget(danwei3);
    test3->addStretch(1);
    QHBoxLayout *test4=new QHBoxLayout;
    test4->addStretch(1);
    test4->addWidget(edTest4);
    test4->addWidget(testEdit4);
    test4->addWidget(danwei4);
    test4->addStretch(1);
    QHBoxLayout *test5=new QHBoxLayout;
    test5->addStretch(1);
    test5->addWidget(edTest5);
    test5->addWidget(testEdit5);
    test5->addWidget(danwei5);
    test5->addStretch(1);
    QHBoxLayout *test6=new QHBoxLayout;
    test6->addStretch(1);
    test6->addWidget(edTest6);
    test6->addWidget(testEdit6);
    test6->addWidget(danwei6);
    test6->addStretch(1);
    QHBoxLayout *test7=new QHBoxLayout;
    test7->addStretch(1);
    test7->addWidget(xxTest1);
    test7->addWidget(testEdit7);
    test7->addWidget(danwei7);
    test7->addStretch(1);

    QHBoxLayout *test8=new QHBoxLayout;
    test8->addStretch(1);
    test8->addWidget(xxTest2);
    test8->addWidget(testEdit8);
    test8->addWidget(danwei8);
    test8->addStretch(1);
    QHBoxLayout *test9=new QHBoxLayout;
    test9->addStretch(1);
    test9->addWidget(xxTest3);
    test9->addWidget(testEdit9);
    test9->addWidget(danwei9);
    test9->addStretch(1);
    QHBoxLayout *test10=new QHBoxLayout;
    test10->addStretch(1);
    test10->addWidget(xxTest4);
    test10->addWidget(testEdit10);
    test10->addWidget(danwei10);
    test10->addStretch(1);
    QVBoxLayout *test11 = new QVBoxLayout;
    test11->addStretch(1);
    test11->addWidget(testRadio1);
    test11->addWidget(testRadio2);
    test11->addWidget(setting_ok);
    test11->addStretch(1);
    QVBoxLayout *maintest = new QVBoxLayout;
    maintest->addStretch(1);
    maintest->addLayout(test);
    maintest->addLayout(test1);
    maintest->addLayout(test2);
    maintest->addLayout(test3);
    maintest->addLayout(test4);
    maintest->addLayout(test5);
    maintest->addLayout(test6);
    maintest->addLayout(test7);
    maintest->addLayout(test8);
    maintest->addLayout(test9);
    maintest->addLayout(test10);

    maintest->addStretch(1);
    QHBoxLayout *maintest1 = new QHBoxLayout;
    maintest1->addStretch(1);
    maintest1->addLayout(maintest);
    maintest1->addSpacing(30);
    maintest1->addLayout(test11);
    maintest1->addStretch(1);

    widgetTest = new QWidget;
    widgetTest->setFixedSize(500,380);
    widgetTest->setStyleSheet(".QWidget{background-color:#bbb;border:1px solid #bbc;border-radius:5px;}");
    widgetTest->setLayout(maintest1);

    connect(testRadio1,SIGNAL(clicked()),this,SLOT(test_radio_chilck()));
    connect(testRadio2,SIGNAL(clicked()),this,SLOT(test_radio_chilck()));
    connect(user_defined,SIGNAL(currentIndexChanged(QString)),this,SLOT(setting_Value(QString)));

    connect(setting,SIGNAL(clicked()),this,SLOT(show_Widget()));
    connect(setting_ok,SIGNAL(clicked()),this,SLOT(hide_widget()));
//*************************CT变比测试***************************//
    addwidget1=new QWidget;
    addwidget1->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
    addwidget1->setFixedSize(1000,400);
    addwidget1->setStyleSheet(".QWidget{background-color:#bbb;}");

    addwidget2=new QWidget;
    addwidget2->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
    addwidget2->setFixedSize(1000,400);
    addwidget2->setStyleSheet(".QWidget{background-color:#bbb;}");
//*******************************************************************//
    shou_dong_setting();
    zi_dong_setting();
 //***************************************************************//
    QHBoxLayout  *mainlayout = new QHBoxLayout;
   // mainlayout->addStretch(1);
    mainlayout->addSpacing(50);
    mainlayout->addLayout(lamian);
    mainlayout->addWidget(addwidget1);
    mainlayout->addWidget(addwidget2);
    mainlayout->addSpacing(150);
    mainlayout->addWidget(widgetTest);
    mainlayout->addStretch(1);
    widgetTest->hide();//隐藏检测点信息
    addwidget1->hide();
    addwidget2->hide();
    this->setLayout(mainlayout);



    connect(Startest,SIGNAL(clicked()),this,SLOT(Manuals_Automatic_page_page()));

    //时间显示
    datetimer = new QTimer(this);
    connect(datetimer, SIGNAL(timeout()), this, SLOT(qtimeSlot()));
    datetimer->start(1000);
    dateshow = new QLabel(tr("time:"));
    dateshow->setFont(ft);

    theKeyBoard = new Dialog(this);

}

void CtTest::setting_Value(QString str)
{
    qDebug()<<str;
    if(str == "常规点")
    {
        setting->hide();
        widgetTest->hide();
    }
    else
    {
        setting->show();
        addwidget1->hide();
        addwidget2->hide();
    }
}

void CtTest::test_radio_chilck()
{
    qDebug()<<testRadio1->isChecked();
    if(testRadio1->isChecked())
    {
        testEdit1->setText("1");
        testEdit2->setText("5");
        testEdit3->setText("20");
        testEdit4->setText("100");
        testEdit5->setText("120");
        testEdit6->setText(" ");
        testEdit7->setText("1");
        testEdit8->setText("5");
        testEdit9->setText("20");
        testEdit10->setText("100");
        testEdit1->setEnabled(false);
        testEdit2->setEnabled(false);
        testEdit3->setEnabled(false);
        testEdit4->setEnabled(false);
        testEdit5->setEnabled(false);
        testEdit6->setEnabled(false);
        testEdit7->setEnabled(false);
        testEdit8->setEnabled(false);
        testEdit9->setEnabled(false);
        testEdit10->setEnabled(false);
    }
    else
    {
        testEdit1->setEnabled(true);
        testEdit2->setEnabled(true);
        testEdit3->setEnabled(true);
        testEdit4->setEnabled(true);
        testEdit5->setEnabled(true);
        testEdit6->setEnabled(true);
        testEdit7->setEnabled(true);
        testEdit8->setEnabled(true);
        testEdit9->setEnabled(true);
        testEdit10->setEnabled(true);
    }
}
void CtTest::shou_dong_setting()
{
    QFont ft;
    ft.setPixelSize(20);
    QLabel *title = new QLabel(tr("CT误差手动测试"));
    title->setFont(ft);
    close = new QPushButton(tr("关闭"));
    close->setFont(ft);
    close->setStyleSheet("background-color:#bbb");
    QGroupBox *parameter = new QGroupBox;
    areaParameter(parameter);//参数
    QGroupBox *dialgage = new QGroupBox;
    areaDialgage(dialgage);//百分表
    QGroupBox *result = new QGroupBox;
    areatest_result(result);//测试结果
    QVBoxLayout *layoutmid = new QVBoxLayout;
    layoutmid->addWidget(dialgage);
    layoutmid->addSpacing(5);
    layoutmid->addWidget(result);

    QHBoxLayout *layoutTop = new QHBoxLayout;
    //layoutTop->addStretch(1);
    layoutTop->setContentsMargins(20,0,0,0);
    layoutTop->addWidget(parameter);
    layoutTop->addLayout(layoutmid);
    layoutTop->addStretch(1);


    QHBoxLayout *layoutTitle = new QHBoxLayout;
    layoutTitle->addStretch(1);
    layoutTitle->addWidget(title);
    layoutTitle->addStretch(1);


    QVBoxLayout *main = new QVBoxLayout;
    main->addLayout(layoutTitle);
    main->addLayout(layoutTop);
    //main->addLayout(layoutdown);

    addwidget1->setLayout(main);
}

void CtTest::zi_dong_setting()
{
    QFont ft;
    ft.setPixelSize(20);
    QLabel *title = new QLabel(tr("CT误差自动测试"));
    title->setFont(ft);

    QTime qtimeObj = QTime::currentTime();
    QString strTime = qtimeObj.toString("h:m:ss ap");
    strTime.prepend("  时间: ");
    QDate qdateObj = QDate::currentDate();
    QString strDate = qdateObj.toString("dddd, MMMM d, yyyy"); //星期、月份、天、年

    strDate.append(strTime);
    //dateshow->setText (strDate);
    bcdw = new QLabel(tr(" f :"));
    bcdw->setFont(ft);
    jcdw = new QLabel(tr(" δ :"));
    jcdw->setFont(ft);

    bctest = new QLabel(tr(" - "));
    jctest = new QLabel(tr(" - "));
    setDataStyle(bctest);
    setDataStyle(jctest);

    QHBoxLayout *showlay = new QHBoxLayout;
    showlay->addSpacing(150);
    showlay->addWidget(bcdw);
    showlay->addWidget(bctest);
    showlay->addSpacing(50);
    showlay->addWidget(jcdw);
    showlay->addWidget(jctest);
    showlay->addStretch(1);


//    QHBoxLayout *layoutdown = new QHBoxLayout;
//    layoutdown->addStretch(1);
//    layoutdown->addWidget(close);
//    layoutdown->addStretch(1);


    QHBoxLayout *layoutTitle = new QHBoxLayout;
    layoutTitle->addStretch(1);
    layoutTitle->addWidget(title);
    layoutTitle->addStretch(1);

    QHBoxLayout *layout7 = new QHBoxLayout;
    //layout7->addStretch(1);
   // layout7->addWidget(dateshow);
    layout7->addStretch(1);
    //data show area
    ft.setPixelSize(12);
    labSumOfRecords = new QLabel(this);
    labSumOfRecords->setFont(ft);
    labSumOfRecords->setFixedSize(80,60);
    labSumOfRecords->move(850,350);
    //    updateSumOfRecords(1);

    ft.setPixelSize(15);
    QLabel *labSN_name = new QLabel("编号");
    labSN_name->setFont(ft);
    labSN_name->setFixedSize(60,37);
    labSN = new QLabel("-");
    labSN->setStyleSheet("color:blue");
    labSN->setFont(ft);
    labSN->setFixedSize(120,37);

    QLabel *labRatio_name = new QLabel("变比");
    labRatio_name->setFont(ft);
    labRatio_name->setFixedSize(60,37);
    labRatio = new QLabel("-");
    labRatio->setStyleSheet("color:blue");
    labRatio->setFont(ft);
    labRatio->setFixedSize(160,37);

    QLabel *labPrecise_name = new QLabel("温度");
    labPrecise_name->setFont(ft);
    labPrecise_name->setFixedSize(60,37);
    labPrecise = new QLabel("-");
    labPrecise->setStyleSheet("color:blue");
    labPrecise->setFont(ft);
    labPrecise->setFixedSize(100,37);

    QLabel *labPowerFactor_name = new QLabel("功率因数");
    labPowerFactor_name->setFont(ft);
    labPowerFactor_name->setFixedSize(60,37);
    labPowerFactor = new QLabel("-");
    labPowerFactor->setStyleSheet("color:blue");
    labPowerFactor->setFont(ft);
    labPowerFactor->setFixedSize(160,37);

    QHBoxLayout *layoutDataLine1 = new QHBoxLayout;
    layoutDataLine1->addWidget(labSN_name);
    layoutDataLine1->addWidget(labSN);
    layoutDataLine1->addWidget(labRatio_name);
    layoutDataLine1->addWidget(labRatio);
    layoutDataLine1->addWidget(labPrecise_name);
    layoutDataLine1->addWidget(labPrecise);


    QLabel *labPN_name = new QLabel("湿度");
    labPN_name->setFont(ft);
    labPN_name->setFixedSize(60,37);
    labPN = new QLabel("-");
    labPN->setStyleSheet("color:blue");
    labPN->setFont(ft);
    labPN->setFixedSize(100,37);

    QLabel *labDate_name = new QLabel("日期");
    labDate_name->setFont(ft);
    labDate_name->setFixedSize(60,37);

    labDate->setStyleSheet("color:blue");
    labDate->setFont(ft);
    labDate->setFixedSize(350,37);

    QLabel *labBlank = new QLabel;
    labBlank->setFixedSize(200,30);
    QHBoxLayout *layoutDataLine2 = new QHBoxLayout;
    //        layoutDataLine2->addWidget(labDate_name);
    //        layoutDataLine2->addWidget(labDate);
    layoutDataLine2->addWidget(labBlank);
    layoutDataLine2->addWidget(labPowerFactor_name);
    layoutDataLine2->addWidget(labPowerFactor);

    layoutDataLine2->addWidget(labPN_name);
    layoutDataLine2->addWidget(labPN);


    QHBoxLayout *layoutDataLine3 = new QHBoxLayout;
    //layoutDataLine3->addWidget(labBlank);
    layoutDataLine3->addSpacing(10);
    layoutDataLine3->addWidget(labDate_name);
    layoutDataLine3->addWidget(labDate);
    layoutDataLine3->addStretch(1);
    labDate->setText (strDate);

    QLabel *labPercent20 = new QLabel("1%");
    labPercent20->setAlignment(Qt::AlignCenter);
    labPercent20->setFont(ft);
    labPercent20->setFixedSize(90,AVGHEIGHT);
    QLabel *labPercent50 = new QLabel("5%");
    labPercent50->setAlignment(Qt::AlignCenter);
    labPercent50->setFont(ft);
    labPercent50->setFixedSize(90,AVGHEIGHT);
    QLabel *labPercent80 = new QLabel("20%");
    labPercent80->setAlignment(Qt::AlignCenter);
    labPercent80->setFont(ft);
    labPercent80->setFixedSize(90,AVGHEIGHT);
    QLabel *labPercent100 = new QLabel("100%");
    labPercent100->setAlignment(Qt::AlignCenter);
    labPercent100->setFont(ft);
    labPercent100->setFixedSize(90,AVGHEIGHT);
    QLabel *labPercent120 = new QLabel("120%");
    labPercent120->setAlignment(Qt::AlignCenter);
    labPercent120->setFont(ft);
    labPercent120->setFixedSize(90,AVGHEIGHT);

    QHBoxLayout *layoutDataLine4 = new QHBoxLayout;
    layoutDataLine4->setContentsMargins(165,0,0,0);
    layoutDataLine4->addWidget(labPercent20);
    layoutDataLine4->addWidget(labPercent50);
    layoutDataLine4->addWidget(labPercent80);
    layoutDataLine4->addWidget(labPercent100);
    layoutDataLine4->addWidget(labPercent120);
    layoutDataLine4->addStretch(1);

    labErrorNormal20Ratio=new QLabel("-");
    setDataStyle(labErrorNormal20Ratio);

    labErrorNormal20Phase=new QLabel("-");
    setDataStyle(labErrorNormal20Phase);

    labErrorNormal50Ratio=new QLabel("-");
    setDataStyle(labErrorNormal50Ratio);

    labErrorNormal50Phase=new QLabel("-");
    setDataStyle(labErrorNormal50Phase);

    labErrorNormal80Ratio=new QLabel("-");
    setDataStyle(labErrorNormal80Ratio);

    labErrorNormal80Phase=new QLabel("-");
    setDataStyle(labErrorNormal80Phase);

    labErrorNormal100Ratio=new QLabel("-");
    setDataStyle(labErrorNormal100Ratio);

    labErrorNormal100Phase=new QLabel("-");
    setDataStyle(labErrorNormal100Phase);

    labErrorNormal120Ratio=new QLabel("-");
    setDataStyle(labErrorNormal120Ratio);

    labErrorNormal120Phase=new QLabel("-");
    setDataStyle(labErrorNormal120Phase);

    QLabel *labNormalLoad = new QLabel("额定误差(VA)");
    labNormalLoad->setStyleSheet("color:brown");
    labNormalLoad->setAlignment(Qt::AlignCenter);
    labNormalLoad->setFont(ft);
    labNormalLoad->setFixedSize(90,AVGHEIGHT);

    QLabel *labRatioError1 = new QLabel("比差(%)");
    labRatioError1->setAlignment(Qt::AlignCenter);
    labRatioError1->setFont(ft);
    labRatioError1->setFixedSize(50+10,AVGHEIGHT);

    QHBoxLayout *layoutDataLine5 = new QHBoxLayout;
    layoutDataLine5->addWidget(labNormalLoad);
    layoutDataLine5->addWidget(labRatioError1);
    layoutDataLine5->addWidget(labErrorNormal20Ratio);
    layoutDataLine5->addWidget(labErrorNormal50Ratio);
    layoutDataLine5->addWidget(labErrorNormal80Ratio);
    layoutDataLine5->addWidget(labErrorNormal100Ratio);
    layoutDataLine5->addWidget(labErrorNormal120Ratio);
    layoutDataLine5->addStretch(1);

    labNormalLoadValue = new QLabel("-");
    labNormalLoadValue->setStyleSheet("color:brown");
    labNormalLoadValue->setAlignment(Qt::AlignCenter);
    labNormalLoadValue->setFont(ft);
    labNormalLoadValue->setFixedSize(90,AVGHEIGHT);

    QLabel *labPhaseError1 = new QLabel("角差(')");
    labPhaseError1->setAlignment(Qt::AlignCenter);
    labPhaseError1->setFont(ft);
    labPhaseError1->setFixedSize(50+10,AVGHEIGHT);

    QHBoxLayout *layoutDataLine6 = new QHBoxLayout;
    layoutDataLine6->addWidget(labNormalLoadValue);
    layoutDataLine6->addWidget(labPhaseError1);
    layoutDataLine6->addWidget(labErrorNormal20Phase);
    layoutDataLine6->addWidget(labErrorNormal50Phase);
    layoutDataLine6->addWidget(labErrorNormal80Phase);
    layoutDataLine6->addWidget(labErrorNormal100Phase);
    layoutDataLine6->addWidget(labErrorNormal120Phase);
    layoutDataLine6->addStretch(1);

    labErrotMiniK1Ratio=new QLabel("-");
    setDataStyle(labErrotMiniK1Ratio);

    labErrotMiniK2Ratio=new QLabel("-");
    setDataStyle(labErrotMiniK2Ratio);

    labErrotMiniK1Phase=new QLabel("-");
    setDataStyle(labErrotMiniK1Phase);

    labErrotMiniK2Phase=new QLabel("-");
    setDataStyle(labErrotMiniK2Phase);

    labErrorMini80Ratio=new QLabel("-");
    setDataStyle(labErrorMini80Ratio);

    labErrorMini80Phase=new QLabel("-");
    setDataStyle(labErrorMini80Phase);

    labErrorMini100Ratio=new QLabel("-");
    setDataStyle(labErrorMini100Ratio);

    labErrorMini100Phase=new QLabel("-");
    setDataStyle(labErrorMini100Phase);

    labErrorMini120Ratio=new QLabel("");
    setDataStyle(labErrorMini120Ratio);

    labErrorMini120Phase=new QLabel("");
    setDataStyle(labErrorMini120Phase);

    QLabel* labMiniLoad = new QLabel("下限误差(VA)");
    labMiniLoad->setStyleSheet("color:brown");
    labMiniLoad->setAlignment(Qt::AlignCenter);
    labMiniLoad->setFont(ft);
    labMiniLoad->setFixedSize(90,AVGHEIGHT);

    QLabel *labRatioError2 = new QLabel("比差(%)");
    labRatioError2->setAlignment(Qt::AlignCenter);
    labRatioError2->setFont(ft);
    labRatioError2->setFixedSize(50+10,AVGHEIGHT);

    QHBoxLayout *layoutDataLine7 = new QHBoxLayout;
    layoutDataLine7->addWidget(labMiniLoad);
    layoutDataLine7->addWidget(labRatioError2);
    layoutDataLine7->addWidget(labErrotMiniK1Ratio);
    layoutDataLine7->addWidget(labErrotMiniK2Ratio);
    layoutDataLine7->addWidget(labErrorMini80Ratio);
    layoutDataLine7->addWidget(labErrorMini100Ratio);
    layoutDataLine7->addWidget(labErrorMini120Ratio);
    layoutDataLine7->addStretch(1);

    labMiniLoadValue = new QLabel("-");
    labMiniLoadValue->setStyleSheet("color:brown");
    labMiniLoadValue->setAlignment(Qt::AlignCenter);
    labMiniLoadValue->setFont(ft);
    labMiniLoadValue->setFixedSize(90,AVGHEIGHT);

    QLabel *labPhaseError2 = new QLabel("角差(')");
    labPhaseError2->setAlignment(Qt::AlignCenter);
    labPhaseError2->setFont(ft);
    labPhaseError2->setFixedSize(50+10,AVGHEIGHT);

    QHBoxLayout *layoutDataLine8 = new QHBoxLayout;
    layoutDataLine8->addWidget(labMiniLoadValue);
    layoutDataLine8->addWidget(labPhaseError2);
    layoutDataLine8->addWidget(labErrotMiniK1Phase);
    layoutDataLine8->addWidget(labErrotMiniK2Phase);
    layoutDataLine8->addWidget(labErrorMini80Phase);
    layoutDataLine8->addWidget(labErrorMini100Phase);
    layoutDataLine8->addWidget(labErrorMini120Phase);
    layoutDataLine8->addStretch(1);

    QVBoxLayout *layoutDataShow = new QVBoxLayout;
    layoutDataShow->setContentsMargins(0,0,0,5);
    layoutDataShow->addLayout(layoutDataLine1);
    layoutDataShow->addLayout(layoutDataLine2);
    layoutDataShow->addLayout(layoutDataLine3);
    layoutDataShow->addLayout(layoutDataLine4);
    layoutDataShow->addLayout(layoutDataLine5);
    layoutDataShow->addLayout(layoutDataLine6);
    layoutDataShow->addLayout(layoutDataLine7);
    layoutDataShow->addLayout(layoutDataLine8);
    layoutDataShow->addStretch(1);

    ft.setPixelSize(15);
    tableShowData = new QWidget;
    tableShowData->setStyleSheet(".QWidget{background:url(:/image/res/1234.PNG)  no-repeat center;}");
    tableShowData->setFixedSize(650,300);
    tableShowData->setLayout(layoutDataShow);
    tableShowData->installEventFilter(this);

    QHBoxLayout *layoutShowData = new QHBoxLayout;
    //layoutShowData->setAlignment(Qt::AlignCenter);
    //layoutShowData->addStretch(1);
    layoutShowData->addWidget(tableShowData);
    layoutShowData->addStretch(1);



    QVBoxLayout *layoutDemo = new QVBoxLayout;
//    layoutDemo->setContentsMargins(0,0,0,20);
//    layoutDemo->setAlignment(Qt::AlignCenter);
    layoutDemo->addStretch(1);
    //layoutDemo->addWidget(barFindData);
    layoutDemo->addLayout(layoutTitle);
    layoutDemo->addSpacing(10);
    layoutDemo->addLayout(layoutShowData);
    layoutDemo->addSpacing(10);
    layoutDemo->addLayout(showlay);
    //layoutDemo->addLayout(layoutdown);
    layoutDemo->addStretch(1);
    addwidget2->setLayout(layoutDemo);
}

void CtTest::Manuals_Automatic_page_page() //自动手动
{

   if(btnStart->isChecked())
   {
//       setting->hide();
       addwidget2->hide();
       addwidget1->show();
       hide_widget();
       qDebug()<<"1111111111";
    }
    else
    {
       //setting->hide();
       addwidget1->hide();
       addwidget2->show();
       hide_widget();
       qDebug()<<"2222222222";
    }
}
void CtTest::setDataStyle(QLabel *lab)
{
    QFont ft;
    ft.setPixelSize(15);

    lab->setFixedSize(90,27);
    lab->setFont(ft);
    lab->setAlignment(Qt::AlignCenter);

    lab->setStyleSheet("color:blue;");
}


void CtTest::areaDialgage(QGroupBox *dialgage)
{
    QFont ft;
    ft.setPixelSize(15);
    bfbEdit= new QLineEdit;
    bfbEdit->setFixedSize(150,LABELHIGHTH-5);
    bfbEdit->setFont(ft);
    bfbEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");

    QLabel *danweibfb = new QLabel(tr("%"));
    danweibfb->setFont(ft);

    bfbBtn1=new QPushButton;
    bfbBtn1->setStyleSheet("background:url(:/image/res/arrowheads_up.png)  no-repeat center;border:0px;");
    bfbBtn1->setFixedSize(40,30);
    bfbBtn2=new QPushButton;
    bfbBtn2->setStyleSheet("background:url(:/image/res/arrowheads_down.png)  no-repeat center;border:0px;");
    bfbBtn2->setFixedSize(40,30);
    changeBtn=new QPushButton(tr("粗"));
    changeBtn->setStyleSheet("QPushButton{ font-family:'Microsoft YaHei';font-size:24px;color:#C4C4C4;background-color:#666;border-radius:15px;}");
    changeBtn->setFixedSize(40,30);
    bfbset0 = new QPushButton(tr("零"));
    bfbset0->setStyleSheet("QPushButton{ font-family:'Microsoft YaHei';font-size:24px;color:#C4C4C4;background-color:#666;border-radius:15px;}");
    bfbset0->setFixedSize(40,30);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addStretch(1);
    layout->addWidget(bfbBtn1);
    layout->addWidget(bfbBtn2);
    layout->addStretch(1);

    QVBoxLayout *layout1 = new QVBoxLayout;
    layout1->addStretch(1);
    layout1->addWidget(changeBtn);
    layout1->addWidget(bfbset0);
    layout1->addStretch(1);

    QHBoxLayout *layout2 = new QHBoxLayout;
    layout2->addStretch(1);
    layout2->addWidget(bfbEdit);
    layout2->addWidget(danweibfb);
    layout2->addLayout(layout);
    layout2->addLayout(layout1);


    QVBoxLayout *main = new QVBoxLayout;
    main->addSpacing(30);
    main->addLayout(layout2);
    main->addStretch(1);

    dialgage->setLayout(main);

    dialgage->setFixedSize(300,4*LABELHIGHTH);
    dialgage->setTitle(" 百分表 ");
    dialgage->setFont(ft);
    dialgage->setStyleSheet(".QGroupBox{background-color:none; border:2px solid gray;border-radius:5px;font-size:17px;}QGroupBox:title{color:darkblue;}");
    connect(bfbBtn1,SIGNAL(clicked()),this,SLOT(bfb_UP()));
    connect(bfbBtn2,SIGNAL(clicked()),this,SLOT(bfb_DOWN()));
    connect(bfbset0,SIGNAL(clicked()),this,SLOT(bfb_SET0()));
    connect(changeBtn,SIGNAL(clicked()),this,SLOT(bfb_CHANGE()));
}

void CtTest::bfb_UP()
{
    double bfbText=bfbEdit->text().toDouble();
    double cuAdjust=5,xiAdjust=0.5;
    if(changeBtn->text()=="粗")
    {
        bfbText+=cuAdjust;
        bfbEdit->setText(QString::number(bfbText));
    }
    else
    {
        bfbText+=xiAdjust;
        bfbEdit->setText(QString::number(bfbText));
    }
}
void CtTest::bfb_DOWN()
{

    double bfbText=bfbEdit->text().toDouble();
    double cuAdjust=5,xiAdjust=0.5;
    if(changeBtn->text()=="粗")
    {
        bfbText-=cuAdjust;
        bfbEdit->setText(QString::number(bfbText));
    }
    else
    {
        bfbText-=xiAdjust;
        bfbEdit->setText(QString::number(bfbText));
    }
}
void CtTest::bfb_SET0()
{
    bfbEdit->setText(QString::number(0));
}
void CtTest::bfb_CHANGE()
{
    if(changeBtn->text()=="粗")
    {
        changeBtn->setText("细");
        bfbBtn1->setStyleSheet("background:url(:/image/res/arrowheads_up_light.png)  no-repeat center;border:0px;");
        bfbBtn2->setStyleSheet("background:url(:/image/res/arrowheads_down_light.png)  no-repeat center;border:0px;");
    }
    else
    {
        changeBtn->setText("粗");
        bfbBtn1->setStyleSheet("background:url(:/image/res/arrowheads_up.png)  no-repeat center;border:0px;");
        bfbBtn2->setStyleSheet("background:url(:/image/res/arrowheads_down.png)  no-repeat center;border:0px;");
    }
}

void CtTest::areatest_result(QGroupBox *result)
{
    QFont ft;
    ft.setPixelSize(15);
    QLabel *bcLabel = new QLabel(tr("比差："));
    bcLabel->setFont(ft);
    QLabel *jcLabel = new QLabel(tr("角差: "));
    jcLabel->setFont(ft);
    bcEdit= new QLineEdit;
    bcEdit->setFixedSize(150,LABELHIGHTH-5);
    bcEdit->setFont(ft);
    bcEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");
    jcEdit= new QLineEdit;
    jcEdit->setFixedSize(150,LABELHIGHTH-5);
    jcEdit->setFont(ft);
    jcEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");

    QHBoxLayout *layout1 = new QHBoxLayout;
    layout1->addWidget(bcLabel);
    layout1->addWidget(bcEdit);

    QHBoxLayout *layout2 = new QHBoxLayout;
    layout2->addWidget(jcLabel);
    layout2->addWidget(jcEdit);

    QVBoxLayout *main = new QVBoxLayout;
    main->addSpacing(30);
    main->addLayout(layout1);
    main->addSpacing(10);
    main->addLayout(layout2);
    main->addStretch(1);

    result->setLayout(main);

    result->setFixedSize(300,5*LABELHIGHTH);
    result->setTitle(" 测试结果 ");
    result->setStyleSheet(".QGroupBox{background-color:none; border:2px solid gray;border-radius:5px;font-size:17px;}QGroupBox:title{color:darkblue;}");
}

void CtTest::areaParameter(QGroupBox *parameter)
{
    QFont ft;
    ft.setPixelSize(15);

    QLabel *bj=new QLabel(tr("变比      :"));
    //bj->setFixedSize(32,LABELHIGHTH);
    bj->setFont(ft);

    bbEdit=new QLineEdit;
    bbEdit->setFixedSize(150,LABELHIGHTH-5);
    bbEdit->setFont(ft);
    bbEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");

    QLabel *fh = new QLabel(tr("负荷      :"));
    fh->setFont(ft);

    fhEdit=new QLineEdit;
    fhEdit->setFixedSize(150,LABELHIGHTH-5);
    fhEdit->setFont(ft);
    fhEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");
    QLabel *v = new QLabel(tr("VA"));
    v->setFont(ft);

    QLabel *glys = new QLabel(tr("功率因素:"));
    glys->setFont(ft);
    glEdit = new QLineEdit;
    glEdit->setFixedSize(150,LABELHIGHTH-5);
    glEdit->setFont(ft);
    glEdit->setStyleSheet("QLineEdit{border-width:0;border-style:outset}");

    QHBoxLayout *layout1 = new QHBoxLayout;
    //layout1->addStretch(1);
    layout1->addWidget(bj);
    layout1->addWidget(bbEdit);
    layout1->addStretch(1);

    QHBoxLayout *layout2 = new QHBoxLayout;
    //layout1->addStretch(1);
    layout2->addWidget(fh);
    layout2->addWidget(fhEdit);
    layout2->addWidget(v);
    layout2->addStretch(1);

    QHBoxLayout *layout3 = new QHBoxLayout;
    layout3->addWidget(glys);
    layout3->addWidget(glEdit);
    layout3->addStretch(1);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addSpacing(30);
    mainLayout->addLayout(layout1);
    mainLayout->addSpacing(10);
    mainLayout->addLayout(layout2);
    mainLayout->addSpacing(10);
    mainLayout->addLayout(layout3);
    mainLayout->addStretch(1);

    parameter->setLayout(mainLayout);

    parameter->setFixedSize(300,9*LABELHIGHTH+20);
    parameter->setTitle(" 参数 ");
    parameter->setFont(ft);
    parameter->setStyleSheet(".QGroupBox{background-color:none; border:2px solid gray;border-radius:5px;font-size:17px;}QGroupBox:title{color:darkblue;}");
}



void CtTest::close_page()
{
    if(Manuals->isChecked())
    {
        addwidget1->close();
    }
    else
    {
        addwidget2->close();
    }
}
//void CtTest::close_1A()
//{
//    addwidget3->close();
//}
//void CtTest::close_5A()
//{
//    addwidget4->close();
//}
void CtTest::qtimeSlot()
{
    QTime qtimeObj = QTime::currentTime();
    QString strTime = qtimeObj.toString("h:m:ss ap");
    strTime.prepend("  时间: ");
    QDate qdateObj = QDate::currentDate();
    QString strDate = qdateObj.toString("dddd, MMMM d, yyyy"); //星期、月份、天、年

    strDate.append(strTime);
    labDate->setText (strDate);

}
bool CtTest::eventFilter(QObject *obj, QEvent *event)
{
    if( obj == BHEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(BHEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == XHEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(XHEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == edEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(edEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == xxEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(xxEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == IEdit1)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(IEdit1);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == IEdit2)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(IEdit2);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == JDEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(JDEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == YSEdit)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(YSEdit);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit1)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit1);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit2)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit2);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit3)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit3);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit4)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit4);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit5)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit5);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit6)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit6);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit7)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit7);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit8)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit8);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit9)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit9);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }
    if( obj == testEdit10)
    {
        if(event->type() == QEvent::FocusIn)
        {
            theKeyBoard->setCurrentActive(testEdit10);
        }
        else if(event->type() == QEvent::FocusOut)
        {
            theKeyBoard->hide();
        }
    }

    return false;
}
void CtTest::recvResult(QByteArray rcvdByte)
{

}
